Repository navigation
Give up on a fetch that ignores its abort signal - #35
Merged
Merged
Conversation
Regression tests for #33, which fail until send() has its own bound: a fetch that ignores its abort signal, a late answer or failure, and a body that never ends. The flush()/close() drain test gives each drain its own client, since the second drain would otherwise find nothing in flight once attempts are given up at the timeout. Co-Authored-By: Claude Opus 5.5 <[email protected]>
send() relied on the fetch honouring the abort, so a custom fetch that dropped the signal left report()'s promise unsettled and held its in-flight slot for good. Race the fetch and the body read against the timeout instead. Closes #33. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
|
Self-review rubric (head
Do-not-auto-merge check: no listed path matched. Judgment calls and findings:
No Phase 4 item failed, so no follow-up commit is needed. This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
send()now has its own bound. The fetch is raced against the timeout, so an attempt is given up attimeoutMseven when a customfetchignores its abort signal: the slot is freed, the drop is logged, and thereport()promise resolves, as its TSDoc already said it would.fetchthat honours it and rejects at once still reports its own failure. Afetchthat ignores it gets the debug linecould not deliver <body>: Error: no answer within <n>ms.fetchrow, thefetchoption TSDoc andCHANGELOG.md[Unreleased]say the same.Closes #33
Changed test
flush() and close() with no argument wait at most the client's own timeout, even when fetch ignores the abortnow gives each drain its own client. With the fix, the attempt ends at the timeout, so theclose()that followedflush()on one shared client had nothing left to wait on. Its assertions are kept. Its< 2000bound no longer tells a default oftimeoutMsapart fromTIMEOUT_MS, because the attempt itself now ends at the client timeout, so that difference is no longer observable through a default drain.Test plan
testjob is red on the tests-only commitd52ee66, naming exactly the three new tests (run 42160971470:# tests 76,# pass 73,# cancelled 3, each hitting its test timeout)testjob, includingnpm run typecheck, is green on the head commitcbd20f7(run 42161116862:# tests 76,# pass 76,# fail 0,# cancelled 0)nodeis absent from this environment, so CI on the head SHA is the gateCross-client parity
No cross-client-visible behavior changed: the wire format, opt-out values and
disabledReasonstrings are untouched, and the request insend()is only re-indented. Thefetchoption is specific to this client. trace-client-python and trace-client-java were not inspected for an equivalent problem.CHANGELOG
CHANGELOG.mdgained an entry under[Unreleased]. The version string is unchanged.CI covers Node 22 only, so nothing here ran in the Next.js Edge runtime, Cloudflare Workers or Node 18. The change adds only
Promise.raceandError, both within the ES2022 baseline. Whether a realfetchrejects with itsAbortErroror loses the race to theno answer withinerror was not pinned by a test; either way acould not deliverline is logged.This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson